package com.voilet.interview

import android.app.Fragment
import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity
import androidx.fragment.app.FragmentManager

class MainActivity : AppCompatActivity(),FragmentManager.OnBackStackChangedListener {
    override fun onBackStackChanged() {

    }

    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        setContentView(R.layout.activity_main)
        if (null != savedInstanceState){
            fragmentManager.getFragment(savedInstanceState,"fragment")
        }
    }

    override fun onSaveInstanceState(outState: Bundle?) {
        super.onSaveInstanceState(outState)
        fragmentManager.putFragment(outState,"fragment", Fragment.instantiate(this,""))
        fragmentManager.addOnBackStackChangedListener{}
    }

}
